/*-----------------------------------------------------------------------------
 * 
 *  Main (CircuitLab): 
 *  
 *  Bootstrap code for the CircuitLab application - displays splash screen and
 *  calls config verification.  Finally, starts the main application.
 *  
 *   created: June 23, 2008
 *  modified: June 25, 2008
 *
 *-----------------------------------------------------------------------------
 */

package circuitlab;

import application.Configuration;
import circuitlab.ui.CLSplashScreen;

public class Main {
    public static void main(String args[]) {
        CLSplashScreen splash;
        CircuitLab circuitlab;
        Configuration config;
        int config_status;

        splash = new CLSplashScreen();

        if (splash == null) {

        }

        circuitlab = new CircuitLab("circuitlab");

        if (circuitlab == null) {
            Logging.error(0);
            System.exit(1);
        }

        config = circuitlab.readConfigurationFile();
        config_status = config.status;

        if (config_status != 0) {
            // either (1) there is no configuration (first time run) or
            // (2) configuration has parse/formatting errors.

            switch (config_status) {
            case Configuration.CONFIGURATION_NONE:

                break;

            case Configuration.CONFIGURATION_INVALID:

                break;
            }

        } else {
            // valid configuration. apply the configuration and start
            // application

            circuitlab.init(splash);
        }

    }

}
